--- CMakeLists.txt	2022-08-23 14:57:53.000000000 +0530
+++ CMakeLists1.txt	2023-02-20 23:29:17.032740887 +0530
@@ -1,6 +1,25 @@
-
+cmake_minimum_required(VERSION 3.10)
 set(LIBNAME uavs3e)
 
+# check cpu
+
+if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i386" OR
+   "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i486" OR
+   "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i586" OR
+   "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i686" OR
+       "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86")
+    message(FATAL_ERROR "Uavs3e Encoder does not run on 32-bit x86 systems \n")
+elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "^arm")
+    mesasage(FATAL_ERROR "Uavs3e Encoder does not run on 32-bit ARM systems \n")
+elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "aarch64" OR "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm64")
+    message(STATUS "System Architecture is ARM-64 bit it runs on ARMv8 processor \n")
+elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "AMD64" OR
+       "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
+    message(STATUS "System Architecture is x86_64 \n")
+else()
+    message(FATAL_ERROR "This Program will not run on this platform, aborting... \n")
+endif()
+
 # add source
 aux_source_directory(. DIR_UAVS3E_SRC)
 if("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "aarch64" OR "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm64")
@@ -36,9 +55,9 @@
     add_definitions(-DCOMPILE_10BIT=0)
 endif()
 
-set_source_files_properties(${DIR_UAVS3E_SRC} PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} -fPIC -std=c99 -O3")
-set_source_files_properties(${DIR_X86_SRC} PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} -fPIC -std=c99 -O3 -msse4.2")
-set_source_files_properties(${DIR_X86_256_SRC} PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} -fPIC -std=c99 -O3 -mavx2")
+set_source_files_properties(${DIR_UAVS3E_SRC} PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} -fPIC -std=c99 -O2")
+set_source_files_properties(${DIR_X86_SRC} PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} -fPIC -std=c99 -O2 -msse4.2")
+set_source_files_properties(${DIR_X86_256_SRC} PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} -fPIC -std=c99 -O2 -mavx2")
 
 # get version
 set (CONFIG_DIR ${CMAKE_CURRENT_SOURCE_DIR}/..)
@@ -59,7 +78,11 @@
 find_package(Threads REQUIRED)
 set(prefix "${CMAKE_INSTALL_PREFIX}")
 set(includedir "include")
+if(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
+set(libdir "lib64")
+else()
 set(libdir "lib")
+endif()
 set(pc_file "${CONFIG_DIR}/${LIBNAME}.pc")
 
 set(CMAKE_INSTALL_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/${includedir}")
